﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace dotNails.CodeGen.Util {
	public class LogUtil {
		public static void EventLogMessage(string message) {
			EventLog eventLog = new EventLog();
			eventLog.Source = "dotNailsLinqToSqlGenerator";
			eventLog.WriteEntry(message);
		}
		
		public static void EventLogMessage(string message, Exception innerException, string stackTrace) {
	        EventLog eventLog = new EventLog();
	        eventLog.Source = "dotNails";
			string innerExceptionMessage = string.Empty;
			if (innerException != null) {
				innerExceptionMessage = innerException.Message;
			}
	        eventLog.WriteEntry(message + "\nInnerException:\n" + innerExceptionMessage + "\nStack Trace:\n" + stackTrace);
	    }
	}
}
